package com.icez.demo

import android.content.ClipData
import android.content.Intent
import android.view.View

class Util {
    companion object {
        val instance: Util by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
             Util()
        }
    }

    /**
     * 设置控件拖动
     *
     * @param intent 拖动控件携带的意图
     * @param view 拖动的控件
     */
    public fun setDrag(intent:Intent,view:View?){
        val dragData = ClipData.newIntent("value",intent)
        val mDragShadowBuilder = View.DragShadowBuilder(view)
        view?.startDragAndDrop(dragData,mDragShadowBuilder,null,0)
    }
}